package com.ticker.national.util;

import java.util.HashMap;


public class Log {
	
	private final static String TAG = "ParsingPerson";
    static final boolean DEBUG = true;
    public static final boolean DEVELOPER_MODE = false;
//    private boolean isEntered;
    private static long enteredAt;
    private static long endedAt;
	
    private static HashMap<String, Long> mTimeMap = new HashMap<String, Long>();
    
    public static void d(String logMe) {
    	if(DEBUG)
    		android.util.Log.d(TAG, /*SystemClock.uptimeMillis() + " "  + */logMe);
    }
    
    public static void d(String tag, String logMe) {
    	if(DEBUG)
    		android.util.Log.d(TAG, tag + ", " + logMe);
    }
    
    public static void d(String tag, String logMe, boolean isEntered) {
    	if(DEBUG) {
    		if(isEntered) {
    			enteredAt = System.currentTimeMillis();
    			mTimeMap.put(tag+logMe, enteredAt);
    			android.util.Log.d(TAG, tag + ", " + logMe + "entered At: " + enteredAt);
    		}
    		else {
    			endedAt = System.currentTimeMillis();
    			long diff = endedAt- mTimeMap.get(tag+logMe);
    			android.util.Log.d(TAG, tag + ", " + logMe + "ended At: " + endedAt + ", diff: " + diff);
    		}
    	}
    }
    
    public static void i(String logMe) {
    	if(DEBUG)
    		android.util.Log.i(TAG, /*SystemClock.uptimeMillis() + " " +*/logMe);
    }
    
    public static void i(String tag, String logMe) {
    	if(DEBUG)
    		android.util.Log.i(TAG, tag + ", "/* + SystemClock.uptimeMillis() + " "*/ + logMe);
    }

    public static void e(String logMe) {
    	if(DEBUG)
    		android.util.Log.e(TAG, logMe);
    }
    
    public static void e(String tag, String logMe) {
    	if(DEBUG)
    		android.util.Log.e(TAG, tag + ", " + /* SystemClock.uptimeMillis() + " " + */ logMe);
    }

    public static void e(String logMe, Exception ex) {
    	if(DEBUG)
    		android.util.Log.e(TAG, logMe, ex);
    }
}
